<template>
    <div class="Newsinfo">
        <h6>{{info.title}}</h6>
        <br>
        <span class="left">发表时间：{{info.add_time}}</span><span class="right">点击<em>{{info.click}}</em>次</span>
        <br>
        <hr>
        <div class="content" v-html="info.content" >
        </div>
        <!-- 评论区域 -->
        <Comment :id="this.id"></Comment>
    </div>

    
</template>

<script>
import Comment from "./Comment.vue"
//引入

export default {
    name:"Newsinfo",
    data(){
        return {
            id:this.$route.params.id,
            info:[]
        }
    },
    created(){
        this.getnewsinfo()
    },
    methods:{
        getnewsinfo(){
            this.$axios({
                method:"get",
                url:'http://www.liulongbin.top:3005/api/getnew/'+this.id,
          }).then((res)=>{
            //   console.log(res)
            //   console.log(res.data)
              this.info = res.data.message[0]
            //   console.log(this.info)
          })
        } 
    },
    components:{
        Comment
    }
}
</script>
<style >
body{
    background-color: #fff;
}
.left{
    float: left;
}
.right{
    float: right;
}
    .Newsinfo h6{
        margin-top: .2rem;
        font-size: .3rem;
        text-align: center;
        color:red;
    }
    .Newsinfo span{
        font-size: .28rem;
        color: skyblue;
    }
    .Newsinfo p{
        color: #000;
    }
</style>
